*JCR UED replication tables 1-2, A1-A2*

*change directory to where you saved data*
cd "folder name"
use "UED JCR repdata finalsubm.dta", clear
tsset cowcode year

*Table 1: EXAMINE TORTURE TYPES AND TERRORISM BACKLASH* 
*constrain sample to same N in all models, use model with smallest N*
xtnbreg gtddomevents  spLag_domlag ln_stealthlag ln_scarringlag restacclag ln_reportcountlag  speechlag ljilag revphysint_notortlag  ln_unstatedlag  ln_cgdplag ln_poplag democracylag durablelag i.year , fe
gen sample=1 if e(sample)

*POOLED MODELS*
*Main model, pooled*
nbreg gtddomevents gtddomavg spLag_domlag  ln_scarringlag ln_stealthlag ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store tort1
*Information environment, pooled* 
nbreg gtddomevents gtddomavg spLag_domlag  ln_scarringlag ln_stealthlag restacclag ln_reportcountlag  ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store tort2
*Institutional environment, pooled* 
nbreg gtddomevents gtddomavg spLag_domlag   ln_scarringlag ln_stealthlag restacclag ln_reportcountlag  ljilag speechlag ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store tort3
*HR environment, pooled*
nbreg gtddomevents gtddomavg spLag_domlag  ln_scarringlag ln_stealthlag restacclag ln_reportcountlag  ljilag speechlag ln_unstatedlag revphysint_notortlag ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store tort4

*FIXED EFFECTS*
*Main model, fixed effects*
xtnbreg gtddomevents  spLag_domlag  ln_scarringlag ln_stealthlag ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1,fe
est store tort5
*Information environment, fe* 
xtnbreg gtddomevents  spLag_domlag  ln_scarringlag ln_stealthlag restacclag ln_reportcountlag  ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, fe
est store tort6
*Institutional environment, fe* 
xtnbreg gtddomevents  spLag_domlag  ln_scarringlag ln_stealthlag restacclag ln_reportcountlag  speechlag ljilag  ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, fe
est store tort7
*HR environment, fe*
xtnbreg gtddomevents  spLag_domlag  ln_scarringlag ln_stealthlag restacclag ln_reportcountlag  speechlag ljilag revphysint_notortlag  ln_unstatedlag  ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, fe
est store tort8

outreg2 [tort1 tort2 tort3 tort4 tort5 tort6 tort7 tort8] using myfileinc1, word drop(i.year* year*) replace dec(3) 10pct 

*TABLE 2: Endogeneity Concerns*
*restrict model to smallest N*
nbreg stealth gtddomeventslag   restacclag ln_reportcountlag speechlag ljilag revphysint_notortlag democracylag onset1v412 ln_cgdplag ln_poplag i.year , cluster(cowcode)
gen sample2=1 if e(sample)

*New models with scarring and stealth as DV and SUREG models*
*POOLED MODEL*
*Scarring torture*
nbreg scarring gtddomeventslag restacclag ln_reportcountlag speechlag ljilag revphysint_notortlag   democracylag onset1v412 ln_cgdplag ln_poplag i.year if sample2==1 , cluster(cowcode)
est store scarring1
*Stealth torture*
nbreg stealth gtddomeventslag   restacclag ln_reportcountlag speechlag ljilag revphysint_notortlag democracylag onset1v412 ln_cgdplag ln_poplag i.year if sample2==1 , cluster(cowcode)
est store stealth1
**FIXED EFFCTS*
*Scarring torture*
xtnbreg scarring gtddomeventslag restacclag ln_reportcountlag speechlag ljilag revphysint_notortlag democracylag onset1v412 ln_cgdplag ln_poplag i.year if sample2==1 , fe
est store scarring2
*Stealth torture*
xtnbreg stealth gtddomeventslag restacclag ln_reportcountlag speechlag ljilag revphysint_notortlag   democracylag onset1v412 ln_cgdplag i.year ln_poplag if sample2==1 , fe
est store stealth2
outreg2 [scarring1 stealth1 scarring2 stealth2] using myfileinc2, word drop(i.year* year*) replace dec(3) 10pct 
*Choice of technique*
mlogit torturetype gtddomeventslag restacclag ln_reportcountlag speechlag ljilag revphysint_notortlag  democracylag onset1v412 ln_cgdplag ln_poplag i.year if sample2==1, cluster(cowcode) base(0)
est store type
outreg2 [type]  using myfileinc3, word drop(i.year* year*) replace dec(3) 10pct 

*Table 3: Seemingly unrelated regression*
*Sureg*
sureg  (ln_gtddomevents = spLag_domlag l.gtddomavg   ln_scarringlag ln_stealthlag restacclag ln_reportcountlag  speechlag ljilag  revphysint_notortlag   ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1 , cluster(cowcode)) ///
(ln_scarringlag =gtddomeventslag restacclag ln_reportcountlag  speechlag ljilag   revphysint_notortlag   democracylag onset1v412 ln_cgdplag ln_poplag i.year, cluster(cowcode)) ///
(ln_stealthlag =gtddomeventslag restacclag ln_reportcountlag  speechlag ljilag  revphysint_notortlag   democracylag onset1v412 ln_cgdplag ln_poplag i.year  , cluster(cowcode))
est store sureg
outreg2 [sureg] using myfileinc4, word drop(i.year* year*) replace dec(3) 10pct 

*Table A1: Summary Statistics of Independent and Dependent Variables*
*run  model*
xtnbreg gtddomevents  spLag_domlag ln_stealthlag ln_scarringlag restacclag ln_reportcountlag  speechlag ljilag revphysint_notortlag  ln_unstatedlag  ln_cgdplag ln_poplag democracylag durablelag i.year , fe
*Run ttests on important variables for democracy, saving means and t-statistics* 
estpost   sum gtdevents spLag_gtdevents revphysintlag stealth scarring ln_stealth ln_scarring ln_aocpolice ln_aocmilitary ln_aocparamilitary ln_aocintelligence ln_aocimmigrationdetention ln_aocprison restrictacc ln_reportcountlag   if e(sample)
esttab using myfilesum2.rtf, cell("mean (fmt(3)) sd(fmt(3))") star rtf label replace

*Table A2: Robustness Tests*
*IVs WO TRANSFORMATION*
nbreg gtddomevents gtddomavg spLag_domlag  scarringlag stealthlag ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store rob1
*RATIO OF SCARRING TORTURE*
nbreg gtddomevents gtddomavg spLag_domlag scarringratio_ln  ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store rob2
*Normalized IVs*
nbreg gtddomevents gtddomavg spLag_domlag zln_scarringlag  zln_stealthlag  ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store rob3
*AGENTS*
nbreg gtddomevents gtddomavg spLag_domlag  l.ln_aocpolice l.ln_aocmilitary l.ln_aocparamilitary l.ln_aocintelligence l.ln_aocimmigrationdetention l.ln_aocprison ln_aocunst ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store rob4
*Preexisting terrorism*
nbreg gtddomevents gtddomavg spLag_domlag  ln_scarringlag ln_stealthlag ln_cgdplag ln_poplag democracylag durablelag i.year if gtd1985to1995sum>=10&sample==1, cluster(cowcode)
est store rob5
*GTD DOMESTIC AND INTERNATIONAL*
nbreg gtdevents gtdmovavg  spLag_gtdeventslag  ln_scarringlag ln_stealthlag ln_cgdplag ln_poplag democracylag durablelag i.year if sample==1, cluster(cowcode)
est store rob6
outreg2 [rob1 rob2 rob3 rob4 rob5 rob6] using myfileinc5, word drop(i.year* year*) replace dec(3) 10pct 

drop sample
drop sample2


